﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using ContactList.Controller;
using PureMVC.Patterns;
using PureMVC.Interfaces;
using ContactList.Utils;

namespace ContactList
{
    public class ApplicationFacade : Facade
    {
        #region Accessors

        /// <summary>
        /// Facade Singleton Factory method.  This method is thread safe.
        /// </summary>
        public new static IFacade Instance
        {
            get
            {
                if (m_instance == null)
                {
                    m_instance = new ApplicationFacade();
                }

                return m_instance;
            }
        }

        #endregion

        #region Public Methods

        public void Startup(Object app)
        {
            NotifyObservers(new Notification(Notifications.APP_STARTUP, app));
        }

        #endregion

        #region Protected & Internal Methods

        protected override void InitializeController()
        {
            base.InitializeController();

            RegisterCommand(Notifications.APP_STARTUP, typeof(ApplicationStartupCommand));
            RegisterCommand(Notifications.GET_ALL_CONTACTS, typeof(GetAllContactsCommand));
        }

        #endregion
    }
}